package com.zzxx.mapper;

import com.zzxx.entity.GymContent;
import com.zzxx.entity.GymContentExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface GymContentMapper extends GymContentMapperEx{
    @SelectProvider(type=GymContentSqlProvider.class, method="countByExample")
    long countByExample(GymContentExample example);

    @DeleteProvider(type=GymContentSqlProvider.class, method="deleteByExample")
    int deleteByExample(GymContentExample example);

    @Delete({
        "delete from gymcontent",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    @Insert({
        "insert into gymcontent (id, gymId, ",
        "userId, content, ",
        "likeNum, createtime)",
        "values (#{id,jdbcType=VARCHAR}, #{gymid,jdbcType=VARCHAR}, ",
        "#{userid,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, ",
        "#{likenum,jdbcType=INTEGER}, #{createtime,jdbcType=TIMESTAMP})"
    })
    int insert(GymContent row);

    @InsertProvider(type=GymContentSqlProvider.class, method="insertSelective")
    int insertSelective(GymContent row);

    @SelectProvider(type=GymContentSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="gymId", property="gymid", jdbcType=JdbcType.VARCHAR),
        @Result(column="userId", property="userid", jdbcType=JdbcType.VARCHAR),
        @Result(column="content", property="content", jdbcType=JdbcType.VARCHAR),
        @Result(column="likeNum", property="likenum", jdbcType=JdbcType.INTEGER),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<GymContent> selectByExample(GymContentExample example);

    @Select({
        "select",
        "id, gymId, userId, content, likeNum, createtime",
        "from gymcontent",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="gymId", property="gymid", jdbcType=JdbcType.VARCHAR),
        @Result(column="userId", property="userid", jdbcType=JdbcType.VARCHAR),
        @Result(column="content", property="content", jdbcType=JdbcType.VARCHAR),
        @Result(column="likeNum", property="likenum", jdbcType=JdbcType.INTEGER),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.TIMESTAMP)
    })
    GymContent selectByPrimaryKey(String id);

    @UpdateProvider(type=GymContentSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("row") GymContent row, @Param("example") GymContentExample example);

    @UpdateProvider(type=GymContentSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("row") GymContent row, @Param("example") GymContentExample example);

    @UpdateProvider(type=GymContentSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(GymContent row);

    @Update({
        "update gymcontent",
        "set gymId = #{gymid,jdbcType=VARCHAR},",
          "userId = #{userid,jdbcType=VARCHAR},",
          "content = #{content,jdbcType=VARCHAR},",
          "likeNum = #{likenum,jdbcType=INTEGER},",
          "createtime = #{createtime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(GymContent row);
}